#include <stdio.h>

/* 1990年1月1日 是星期一 */

int Whatlaep(int i)
{
    int leap;
    leap = (i % 4 == 0 && i % 100 != 0) || i % 400 == 0;//判断闰年
    return leap;
}

int main(void)
{
    int year, month, day, week, leap;
    int sum = 0;//总天数
    int i;
    int Month[] = {31,28,31,30,31,30,31,31,30,31,30};
    scanf("%d/%d/%d", &year, &month, &day);
    for (i = 1990; i < year; i++)
    {
        if ((i % 4 == 0 && i % 100 != 0) || i % 400 == 0)//判断闰年
        {
            
            sum += 366;
        }
        else
        {
            sum += 365;
        }
    }

    for(i = 0; i < month - 1; i++)
    {
        sum += Month[i];
    }
    leap = Whatlaep(year);
    sum = sum + day + leap;
    week = sum % 7;
    if (week != 0)
    {
        printf("%d年%d月%d日是星期%d\n", year, month, day, week);
    }
    else
    {
        printf("%d年%d月%d日是星期日\n", year, month, day);
    }
    return 0;
}